#ifndef RECORDING_H_
#define RECORDING_H_

#include <time.h>

#include "core.h"

/* Event codes defined here */
#define EVENT_STOP                          0x00
#define EVENT_ROTATE_LEFT                   0x01
#define EVENT_ROTATE_RIGHT                  0x02
#define EVENT_SHOULDER_UP                   0x03
#define EVENT_SHOULDER_DOWN                 0x04
#define EVENT_ELBOW_UP                      0x05
#define EVENT_ELBOW_DOWN                    0x06
#define EVENT_GRIPPER_INVERT                0x07
#define EVENT_HOME                          0x08
#define EVENT_TEST                          0x09

struct record_t
{
    unsigned char event_code;
    clock_t clocks;
    
    struct record_t * next_record;
};

/* Record retrieval */
struct record_t * GetFirstRecord(void);
struct record_t * GetNextRecord(void); 

/* Queue Handling */
void AddRecordToQueue(const struct record_t * record);
void DeleteRecordFromQueue(const struct record_t * record);
void RecordEvent(unsigned int event, unsigned long int value);
void ClearRecordList(void);

/* Recording */
void StartRecord(const unsigned char event_code, const unsigned long value);
void EndRecord(void);
void RecordWait(clock_t wait);

void EnableRecording(void);
void DisableRecording(void);
char RecordingMode(void);

op_fnptr GetOpFromEvtCode(unsigned int event);

#endif /*RECORDING_H_*/
